/**
 * 适配设置(1rem = 100px)
 * @author superduchengwu@gmail.com
 * @date 2020/09/01
 */
(function (doc, win) {
  const docEl = doc.documentElement
  let resizeEvt
  if ('orientationchange' in window) {
    resizeEvt = 'orientationchange'
  } else {
    resizeEvt = 'resize'
  }
  const reCalc = function () {
    const clientWidth = docEl.clientWidth
    if (!clientWidth) return
    docEl.style.fontSize = 100 * (clientWidth / 375) + 'px'
  }
  if (!doc.addEventListener) return
  win.addEventListener(resizeEvt, reCalc, false)
  doc.addEventListener('DOMContentLoaded', reCalc, false)
})(document, window)
